package com.itheima.controller;

import com.itheima.vo.Enterprice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author by itheima
 * @Date 2022/4/30
 * @Description
 */
@RestController
@RequestMapping("/books")
public class BookController {

    /**
     * 获取配置数据，与之前一直
     */
    @Value("${enterprice.name}")
    private String userName;

    @Value("${enterprice.age}")
    private Integer userAge;

    @Value("${enterprice.subject[2]}")
    private String classType;

    @Autowired
    private Enterprice enterprice;

    @GetMapping("/{id}")
    public String getBook(@PathVariable Integer id){
        System.out.println(id);
        System.out.println(userAge+userName+classType);
        System.out.println(enterprice);
        return "bookId:"+id;
    }
}
